package org.example;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;

public class PublishMain {
    public static void main(String[] args) {

        Jedis jedis = new Jedis("localhost",6379);

        Thread thread=new Thread(new Runnable() {
            public void run() {
                try{
                    Publish.getPublish();
                }
                catch(Exception e){
                    e.printStackTrace();
                }
            }
        });

        Thread thread1=new Thread(new Runnable() {
            public void run() {
                try{
                    jedis.psubscribe(new SubscriberListener(),Publish.Pattren);
                }
                catch(Exception e){
                    e.printStackTrace();
                }
            }
        });

        thread1.start();
        thread.start();


//        jedis.subscribe(new SubscriberListener(),Publish.channel);

        jedis.close();
    }
}
